package com.wheel.autoconfigure.web.mvc.filter;/*
 * <h3>Title:wheel-parent系统</h3>
 * <p>Copyright (c) 2022, wnfbx@163.com. All rights reserved.</p>
 * @author wnfbx@163.com
 */

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * <dt>Description:BaseErrorController</dt>
 * <dd>异常返回处理请求，用来处理advice捕获不到的异常</dd>
 *
 * @author wnfbx@163.com
 * @version 1.0 <i>2022/5/19 11:31</i>
 * @since jdk1.7+
 */
@Controller
public class BaseErrorController {

    public static final String BASE_ERROR_CONTROLLER_REQUEST_MAPPING = "THROW_EX";

    @RequestMapping(BASE_ERROR_CONTROLLER_REQUEST_MAPPING)
    public void doThrow(HttpServletRequest request) throws Exception {
        throw (Exception) request.getAttribute(CacheExceptionOncePerRequestFilter.EXCEPTION_KEY);
    }
}
